//
//  ViewUtil.m
//  YiJuZhangShou
//
//  Created by URANUS on 16/3/12.
//  Copyright © 2016年 Uranus. All rights reserved.
//

#import "ViewUtil.h"
@implementation ViewUtil

#pragma mark Public
+ (LabelDisclosureIndicatorView *)loadSalersTitleWithBackView:(UIView *)backView
                                                    withTitle:(NSString *)title
                                                andTitleColor:(UIColor *)titleColor{
    UILabel *titleLabel = [[UILabel alloc] init];
    titleLabel.text = title;
    titleLabel.tag = IndictorLabelTag;
    titleLabel.textColor = titleColor;
    titleLabel.font = [UIFont boldSystemFontOfSize:18];
    LabelDisclosureIndicatorView *disclosureIndicatorView = [[LabelDisclosureIndicatorView alloc] init];
    disclosureIndicatorView.dir = Right;
    disclosureIndicatorView.rightText = @"查看更多";
    disclosureIndicatorView.labelFont = TextFont18;
    disclosureIndicatorView.textColor = [UIColor colorWithRed:52/255.0 green:152/255.0 blue:219/255.0 alpha:1.0];
    
    UIView *barView = [[UIView alloc] init];
    barView.backgroundColor = [UIColor colorWithRed:222/255.0 green:222/255.0 blue:222/255.0 alpha:1.0];
    
    [backView addSubview:titleLabel];
    [backView addSubview:disclosureIndicatorView];
    [backView addSubview:barView];
    
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(backView).offset(TenOffsetViewMargin);
        make.centerY.equalTo(backView);
    }];
    [disclosureIndicatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(backView).offset(-TenOffsetViewMargin);
        make.top.bottom.equalTo(titleLabel);
    }];
    [barView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(backView);
        make.left.right.equalTo(backView);
        make.height.equalTo(@BarHeight);
    }];
    return disclosureIndicatorView;
}

@end
